<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h2 id="h2">0</h2>
    <button id="minus">-1</button>
    <button id="add">+1</button>
    <script>
        let minus = document.getElementById("minus");
        let add = document.getElementById("add");
        let h2 = document.getElementById("h2");
        let count = 0
        minus.addEventListener("click",()=>{
            count--;
            h2.innerText = count;
        })

        add.addEventListener("click",()=>{
            count++;
            h2.innerText = count;
        })
    </script>
</body>
</html>